package com.liuxing.doctor.service.impl;

import com.liuxing.doctor.entity.Patient;
import com.liuxing.doctor.mapper.PatientMapper;
import com.liuxing.doctor.service.PatientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @athuer 行柳
 */
@Service
@Slf4j
public class PatientServiceImpl implements PatientService {
    @Resource
    private PatientMapper patientMapper;
    @Override
    public List<Patient> queryAllPatients(String id) {
        return patientMapper.selectAllPatients(id);
    }

    @Override
    public Patient queryById(String id) {
        return patientMapper.selectPatientById(id);
    }

    @Override
    public List<Patient> queryPatientBySearchNameWithDoneDiagnosis(String search_name,String id) {
        return patientMapper.selectPatientBySearchNameWithDoneDiagnosis(search_name,id);
    }

    @Override
    public List<Patient> queryPatientBySearchNameWithNoDoneDiagnosis(String search_name) {
        return patientMapper.selectPatientBySearchNameWithNoDoneDiagnosis(search_name);
    }

    @Override
    public int updatePatient(Map<String, Object> map) {
        return patientMapper.updatePatient(map);
    }

    @Override
    public int deletePatient(String patient_id) {
        return patientMapper.deletePatient(patient_id);
    }

    @Override
    public List<Patient> queryAllPatientWithMedicalRecordIdNotNull(String id) {
        return patientMapper.selectAllPatientWithMedicalRecordIdNotNull(id);
    }

    @Override
    public List<Patient> queryAllPatientWithMedicalRecordIdNull() {
        return patientMapper.selectAllPatientWithMedicalRecordIdNull();
    }

    @Override
    public List<Patient> queryAllPatientWithMedicalRecordIdNotNull () {
        return patientMapper.selectAllPatientWithMedicalNotNull();
    }

    @Override
    public int insertOnePatient (Patient patient) {
        return patientMapper.insertOnePatient(patient);
    }
}
